import cryptoJs from 'crypto-js'
/**
 * des解密
 */
export function decryptDes(message, key = '12345678901234567890123456789012') {
  const keyHex = cryptoJs.enc.Utf8.parse(key)
  const decrypted = cryptoJs.DES.decrypt(
    {
      ciphertext: cryptoJs.enc.Hex.parse(message)
    }, // 若message是base64格式，则无需转16进制hex，直接传入message即可
    keyHex,
    {
      mode: cryptoJs.mode.ECB,
      padding: cryptoJs.pad.Pkcs7
    }
  )
  return decrypted.toString(cryptoJs.enc.Utf8)
}
